<% ' This file is provided as part of ASP Power Widgets Samples ' ' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT ' WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, ' INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES ' OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR ' PURPOSE. ' Copyright 1997-1998. All rights reserved. ' Dalun Software Inc. ASP Power Widgets ' http://dalun.com ' mail: sales@dalun.com ' mail: techsupport@dalun.com ' if you have any suggestions or requirements, please write to us. ' Please set your editor's TAB as 4. ' Revisions: ' 1.00 Initial release ' 1.10 Added reading form items. ' 1.11 Added oUpload.Form, added oUpload.UploadedFiles(i).FormName %> File Upload Test

<% if Request.querystring("Status") = 1 then Set oUpload = Server.CreateObject("ASPPW.upload") oUpload.UserDiskQuota= 2 * 1024 * 1024 oUpload.RejectEmptyExtension = true oUpload.FileExtensionList "*","txt", "gif" ,"jpg" 'remove '*', if you don't allow all types oUpload.UpLoadPath = server.mappath("/") + "\test" i=oUpload.Upload Select Case i case 1 sMsg = "File uploading ends normally." Case -4 sMsg = "User's Disk Quota full. At least one file hasn't been saved." Case -5 sMsg = "Path on server for uploading not found or invalid." Case -6 sMsg = "File type for uploading is not allowed. At least one file hasn't been saved." Case -7 sMsg = "Uploading exception." Case -8 sMsg = "File access failure." case else sMsg = "Exception. Error Code is: " & cstr(i) & "." End Select response.write sMsg + "
" response.write cstr(oUpload.NumofUploadedFiles) + " file(s) uploaded.
" if oUpload.GetLastErrNum <> 0 then response.write oUpload.GetLastErrDescription end if set oFiles = oUpload.UploadedFiles 'return a Collection 'response.write oFiles.count 'Sample operation to a collection 'response.write oFiles.item(1) 'Sample operation to a collection set oForm = oUpload.Form 'return a Collection %> <% for each file in oFiles %> <% next %>
<%=file.filename%> <%=file.filelen%> <%=file.formname%> <%=oform(file.formname)%>
<% set oFiles = nothing set oForm = nothing %> <% set oFormItems = oUpload.FormItems 'return a Collection 'Note: oFormItems is another way to fetch form items. %>

Demonstration of fetching form items: <% for each item in oFormItems %> <% next %>
<%=item.name%> <%=item.value%>
<% set oFormItems = nothing %> <% set oUpload = nothing end if %>

UpLoad Test

 
  UPLOAD FILE
Dalun Software, Inc. [ S U B M I T ]